Next | Prev | Up | Top | Contents | Index
Header File
/**************************************************************************
* *
* Copyright (C) 1993, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
| This is ramdrive.h, containing declarations that are used in both the
| driver and in the unit-test application code. Aside from the unit-test
| module, no user-level code ever needs these declarations. The ram drive
| is accessed through the file system like any other disk.
***************************************************************************/
/**************************************************************************
| The driver name for lboot and configuration is "ramdrive."
| The driver prefix is "rd_"
***************************************************************************/
#define DRIVER_PFX "rd_"
#define DRIVER_NAME "ramdrive"
/**************************************************************************
| MAX_RD_DEVS declares the maximum number of distinct devices supported.
| Ram drive device special files are /dev/dsk/ramblk<n> for block devices
| and /dev/rdsk/ramchr<n> for character devices. In each case <n> is the
| device minor number, between 0 and MAX_RD_DEVS-1.
**************************************************************************/
#define MAX_RD_DEVS 4
/**************************************************************************
| An array of MAX_RD_DEVS structures of the following type is maintained
| in the driver. VECTOR lines for up to MAX_RD_DEVS devices are written
| in /var/sysgen/system/ramdrive.sm, causing that many entries to the
| rd_edtinit() entry point, each entry initializing one structure.
|
| base: address of allocated memory for the "drive." If NULL, this
| minor number has not been initialized or failed initialization.
|
| size: size of the allocated memory in bytes, always rounded down to
| a multiple of IO_NBPP.
|
| copen: count of successful character opens, cleared to 0 in rd_close().
| bopen: count of successful block opens (0 or 1), cleared in rd_close().
| xopen: nonzero when an FEXCL open has succeeded.
|
| nmmap: count of rd_map() entries, decremented in rd_unmap(). When the
| any of copen, bopen, and nmaps over all devices is nonzero, the
| driver returns EBUSY to the rd_unload() entry point.
|
| queue: semaphore used to serialize access for reading and writing.
| (Note however that in a multiprocessor, a user process can
| perform an unsynchronized write to a mapped character device.)
|
| vh: volume header structure prepared in edtinit(), and used to
| initialize block 0 when "formatting" the drive. The block-0
| version can be modified by /etc/mkfs.
**************************************************************************/
typedef struct rd_info {
caddr_t *base;
off_t size;
__uint32_t copen, bopen, xopen, nmmap;
sema_t queue; /* requires sys/sema.h */
struct volume_header vh; /* requires sys/dvh.h */
} rd_info_t;
Next | Prev | Up | Top | Contents | Index